﻿using System;

namespace MathService
{
    public class UsingObject<T> : IDisposable where T : IDisposable
    {
        private readonly T f_Obj;

        [System.Diagnostics.DebuggerStepThrough]
        public UsingObject(T Obj) { f_Obj = Obj; }

        [System.Diagnostics.DebuggerStepThrough]
        public TValue GetValue<TValue>(Func<T, TValue> f) { return f(f_Obj); }

        #region Implementation of IDisposable

        public void Dispose() { f_Obj.Dispose(); }

        #endregion
    }
}
